﻿using QLNH_BUS_WS.QLNH_DAL_WS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace QLNH_BUS_WS
{
    /// <summary>
    /// Summary description for QLNH_BUS_WebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class QLNH_BUS_WebService : System.Web.Services.WebService
    {
        #region AccountBUS

        [WebMethod]
        public bool IsValidAccount(string username)
        {
            AccountBUS account = new AccountBUS();
            return account.IsValidAccount(username);
        }

        [WebMethod]
        public AccountDetailDTO GetAccoutInfo(string username)
        {
            QLNH_DAL_WebServiceSoapClient ws = new QLNH_DAL_WebServiceSoapClient();
            return ws.GetAccoutInfo(username);
        }

        [WebMethod]
        public RoleDTO[] GetAllRole()
        {
            AccountBUS account = new AccountBUS();
            return account.GetAllRole();
        }

        [WebMethod]
        public AccountDetailDTO[] GetAllAccountDetail(string username, string roleID)
        {
            AccountBUS account = new AccountBUS();
            return account.GetAllAccountDetail(username, roleID);
        }

        [WebMethod]
        public bool AddCount(AccountDTO acc)
        {
            AccountBUS account = new AccountBUS();
            return account.AddCount(acc);
        }

        [WebMethod]
        public bool EditAccount(AccountDTO acc)
        {
            AccountBUS account = new AccountBUS();
            return account.EditAccount(acc);
        }

        [WebMethod]
        public bool RemoveAccount(string id)
        {
            AccountBUS account = new AccountBUS();
            return account.RemoveAccount(id);
        }

        #endregion

        #region InfoBUS

        [WebMethod]
        public InfoDTO GetInfo()
        {
            InfoBUS infoBUS = new InfoBUS();
            return infoBUS.GetInfo();
        }

        [WebMethod]
        public bool UpdateInfo(InfoDTO infoDTO)
        {
            InfoBUS infoBUS = new InfoBUS();
            return infoBUS.UpdateInfo(infoDTO);
        }

        #endregion

        #region CatalogBUS

        [WebMethod]
        public CatalogDTO[] GetAllCatalog()
        {
            CatalogBUS catalogBUS = new CatalogBUS();
            return catalogBUS.GetAllCatalog();
        }

        [WebMethod]
        public CatalogDetailDTO[] GetAllCatalogDetail()
        {
            CatalogBUS catalogBUS = new CatalogBUS();
            return catalogBUS.GetAllCatalogDetail();
        }

        [WebMethod]
        public bool AddCatalog(CatalogDTO catalogDTO)
        {
            CatalogBUS catalogBUS = new CatalogBUS();
            return catalogBUS.AddCatalog(catalogDTO);
        }

        [WebMethod]
        public bool EditCatalog(CatalogDetailDTO catalogDetail)
        {
            CatalogBUS catalogBUS = new CatalogBUS();
            return catalogBUS.EditCatalog(catalogDetail);
        }

        [WebMethod]
        public bool RemoveCatalog(string catalogID)
        {
            CatalogBUS catalogBUS = new CatalogBUS();
            return catalogBUS.RemoveCatalog(catalogID);
        }

        #endregion

        #region MealBUS

        [WebMethod]
        public MealDetailDTO[] GetAllMealDetail(string name, string catalogID)
        {
            MealBUS mealBUS = new MealBUS();
            return mealBUS.GetAllMealDetail(name, catalogID);
        }

        [WebMethod]
        public FoodReportDTO[] GetCalledMeals(string catalogID)
        {
            return new MealBUS().GetCalledMeals(catalogID);
        }

        [WebMethod]
        public FoodReportDTO[] GetCalledMealsByDate(DateTime start, DateTime end, string catalogID)
        {
            return new MealBUS().GetCalledMealsByDate(start, end, catalogID);
        }

        [WebMethod]
        public bool AddMeal(MealDTO mealDTO)
        {
            MealBUS mealBUS = new MealBUS();
            return mealBUS.AddMeal(mealDTO);
        }

        [WebMethod]
        public bool EditMeal(MealDTO mealDTO)
        {
            MealBUS mealBUS = new MealBUS();
            return mealBUS.EditMeal(mealDTO);
        }

        [WebMethod]
        public bool RemoveMeal(string id)
        {
            MealBUS mealBUS = new MealBUS();
            return mealBUS.RemoveMeal(id);
        }

        [WebMethod]
        public List<string> GetAllUnit()
        {
            MealBUS mealBUS = new MealBUS();
            return mealBUS.GetAllUnit();
        }

        [WebMethod]
        public double GetPrice(string mealID)
        {
            return new MealBUS().GetPrice(mealID);
        }
        #endregion

        #region TableBUS

        [WebMethod]
        public TableDTO[] GetAllTable()
        {
            TableBUS tableBUS = new TableBUS();
            return tableBUS.GetAllTable();
        }

        [WebMethod]
        public bool AddTable(int capacity)
        {
            TableBUS tableBUS = new TableBUS();
            return tableBUS.AddTable(capacity);
        }

        [WebMethod]
        public bool EditTable(TableDTO tableDTO)
        {
            TableBUS tableBUS = new TableBUS();
            return tableBUS.EditTable(tableDTO);
        }

        [WebMethod]
        public bool RemoveTable(string id)
        {
            TableBUS tableBUS = new TableBUS();
            return tableBUS.RemoveTable(id);
        }
        [WebMethod]
        public TableDTO[] GetAllEmptyTable()
        {
            return new TableBUS().GetAllEmptyTable();
        }

        #endregion

        #region EventBUS

        [WebMethod]
        public EventDTO[] GetAllEvent()
        {
            EventBUS eventBUS = new EventBUS();
            return eventBUS.GetAllEvent();
        }

        [WebMethod]
        public bool AddEvent(EventDTO eventDTO)
        {
            EventBUS eventBUS = new EventBUS();
            return eventBUS.AddEvent(eventDTO);
        }

        [WebMethod]
        public bool EditEvent(EventDTO eventDTO)
        {
            EventBUS eventBUS = new EventBUS();
            return eventBUS.EditEvent(eventDTO);
        }

        [WebMethod]
        public bool RemoveEvent(string id)
        {
            EventBUS eventBUS = new EventBUS();
            return eventBUS.RemoveEvent(id);
        }

        #endregion

        #region OrderBUS

        [WebMethod]
        public OrderDetailDTO[] GetAllOrderForChef()
        {
            return new OrderBUS().GetAllOrderForChef();
        }

        [WebMethod]
        public OrderDetailDTO[] GetAllOrderForWaiter()
        {
            return new OrderBUS().GetAllOrderForWaiter();
        }

        [WebMethod]
        public OrderDetailDTO[] GetAllOrderForCashier()
        {
            return new OrderBUS().GetAllOrderForCashier();
        }

        [WebMethod]
        public OrderDetailDTO GetOrder(int orderNo)
        {
            OrderBUS orderBUS = new OrderBUS();
            return orderBUS.GetOrder(orderNo);
        }
        [WebMethod]
        public int GenerateOrderNo()
        {
            OrderBUS orderBUS = new OrderBUS();
            return orderBUS.GenerateOrderNo();
        }

        [WebMethod]
        public void AddOrder(OrderDetailDTO order)
        {
            OrderBUS orderBUS = new OrderBUS();
            orderBUS.AddOrder(order);
        }

        [WebMethod]
        public void DeleteOrder(int orderNo)
        {
            new OrderBUS().DeleteOrder(orderNo);
        }

        [WebMethod]
        public void UpdateOrder(OrderDetailDTO order)
        {
            new OrderBUS().UpdateOrder(order);
        }

        [WebMethod]
        public void UpdateOrderState(int orderNo, State state)
        {
            new OrderBUS().UpdateOrderState(orderNo, state);
        }
        #endregion

        #region BillBUS

        [WebMethod]
        public BillDTO[] GetAllBill()
        {
            return new BillBUS().GetAllBill();
        }

        [WebMethod]
        public BillDTO[] GetAllBillByDate(DateTime start, DateTime end)
        {
            return new BillBUS().GetAllBill(start, end);
        }

        [WebMethod]
        public bool InsertBill(BillDetailDTO[] billDetail)
        {
            return new BillBUS().InsertBill(billDetail);
        }

        #endregion
    }
}
